bugfix: enhance AddKnowledgeDialog with scrollable content and fixed header#760
bugfix: enhance AddKnowledgeDialog with scrollable content and fixed header#760seanrobertwright wants to merge 1 commit intocoleam00:mainfrom
Conversation
…ader - Introduced ScrollableDialogContent component for better user experience in AddKnowledgeDialog. - Updated dialog structure to include a fixed header and scrollable body, improving accessibility and usability. - Adjusted styles to maintain visual consistency and added maxHeight prop for dynamic height management. - Updated .gitignore to include DIALOG-FIX.md for better tracking of dialog-related changes. This change enhances the dialog's functionality, making it more user-friendly while adhering to design principles.
WalkthroughIntroduces a new ScrollableDialogContent UI primitive and updates DialogContent to accept an optional maxHeight prop. Refactors AddKnowledgeDialog to use ScrollableDialogContent with a fixed header and scrollable body. .gitignore adds DIALOG-FIX.md to ignored files. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant AddKnowledgeDialog
participant UI_Primitives as ScrollableDialogContent
participant Tabs as Tabs/Crawl/Upload
User->>AddKnowledgeDialog: Open dialog
AddKnowledgeDialog->>UI_Primitives: Render with maxHeight (85–90vh)
Note over UI_Primitives: Fixed header rendered<br/>Scrollable body area
UI_Primitives->>AddKnowledgeDialog: Slot header + body
AddKnowledgeDialog->>Tabs: Render tabs inside scrollable body
User->>Tabs: Select "Crawl" or "Upload"
Tabs-->>AddKnowledgeDialog: Update active tab content
User->>AddKnowledgeDialog: Submit action (unchanged handlers)
AddKnowledgeDialog-->>User: Success/Error (existing flow)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.gitignore(1 hunks)archon-ui-main/src/features/knowledge/components/AddKnowledgeDialog.tsx(2 hunks)archon-ui-main/src/features/ui/primitives/dialog.tsx(4 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
archon-ui-main/src/features/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
archon-ui-main/src/features/**/*.{ts,tsx}: Use TanStack Query for all data fetching (no prop drilling); use smart HTTP polling (no WebSockets)
Biome formatting in features: 120-character line length, double quotes, and trailing commas
Apply Tron-inspired glassmorphism styling with Tailwind for feature UIUse Biome in features: 120 character line length, double quotes, and trailing commas
Files:
archon-ui-main/src/features/ui/primitives/dialog.tsxarchon-ui-main/src/features/knowledge/components/AddKnowledgeDialog.tsx
archon-ui-main/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Disallow implicit any in TypeScript
archon-ui-main/src/**/*.{ts,tsx}: Frontend TypeScript must use strict mode with no implicit any
Use TanStack Query for all data fetching; avoid prop drilling
Use database values directly in the frontend; avoid mapping layers between BE and FE types
Files:
archon-ui-main/src/features/ui/primitives/dialog.tsxarchon-ui-main/src/features/knowledge/components/AddKnowledgeDialog.tsx
archon-ui-main/src/features/ui/primitives/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Use Radix UI primitives from the primitives library when building feature components
Use Radix UI primitives from src/features/ui/primitives when creating UI components
Files:
archon-ui-main/src/features/ui/primitives/dialog.tsx
archon-ui-main/src/**/*.{ts,tsx,py}
📄 CodeRabbit inference engine (CLAUDE.md)
In code comments, avoid meta terms like SIMPLIFIED, ENHANCED, LEGACY, CHANGED, REMOVED; comment only on functionality and reasoning (do not mention beta/global rules)
Files:
archon-ui-main/src/features/ui/primitives/dialog.tsxarchon-ui-main/src/features/knowledge/components/AddKnowledgeDialog.tsx
archon-ui-main/src/features/*/components/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Place new UI components under the feature’s components directory
Place new UI components under src/features/[feature]/components
Files:
archon-ui-main/src/features/knowledge/components/AddKnowledgeDialog.tsx
🧬 Code graph analysis (2)
archon-ui-main/src/features/ui/primitives/dialog.tsx (1)
archon-ui-main/src/features/ui/primitives/styles.ts (1)
cn(139-141)
archon-ui-main/src/features/knowledge/components/AddKnowledgeDialog.tsx (4)
archon-ui-main/src/features/ui/primitives/dialog.tsx (4)
ScrollableDialogContent(90-147)DialogHeader(151-155)DialogTitle(171-185)DialogDescription(189-198)archon-ui-main/src/features/ui/primitives/tabs.tsx (2)
Tabs(6-6)TabsContent(90-102)archon-ui-main/src/features/ui/primitives/styles.ts (1)
cn(139-141)archon-ui-main/src/features/ui/primitives/input.tsx (2)
Label(67-81)Input(8-29)
| {/* Scrollable Content Area */} | ||
| <div className="flex-1 overflow-y-auto"> | ||
| {children} | ||
| </div> | ||
|
|
||
| {showCloseButton && ( | ||
| <DialogPrimitive.Close | ||
| className={cn( | ||
| "absolute right-4 top-4 z-20", | ||
| "text-gray-500 dark:text-gray-400", | ||
| "hover:text-gray-700 dark:hover:text-white", | ||
| "transition-colors", | ||
| )} | ||
| > | ||
| <X className="h-5 w-5" /> | ||
| <span className="sr-only">Close</span> | ||
| </DialogPrimitive.Close> | ||
| )} | ||
| </DialogPrimitive.Content> |
There was a problem hiding this comment.
Header still scrolls—wrapper needs restructuring
Wrapping every child inside div.flex-1.overflow-y-auto forces the header consumers pass (e.g., AddKnowledgeDialog) into the scrolling region, so the “fixed” header still scrolls away. Please let the parent render a flex column and allow callers to supply their own non-scrolling header + scrolling body split.
Apply this diff to keep the layout flexible and actually support a fixed header:
- {/* Scrollable Content Area */}
- <div className="flex-1 overflow-y-auto">
- {children}
- </div>
+ <div className="relative z-10 flex h-full flex-col">
+ {children}
+ </div>🤖 Prompt for AI Agents
In archon-ui-main/src/features/ui/primitives/dialog.tsx around lines 127 to 145,
the current implementation wraps every child in a div.flex-1.overflow-y-auto
which forces headers passed by consumers into the scrolling region; remove that
catch-all wrapper and instead render a flex column container where the component
does not assume every child is scrollable—provide a slot/prop expectation or a
specific body wrapper: render children directly (so callers can place a
non-scrolling header and a scrollable body themselves) or accept separate header
and body props and only wrap the body in div.flex-1.overflow-y-auto; keep the
Close button placement unchanged so it remains absolutely positioned.
|
Thank you for this! @leex279 could you please take a look at see if this is good on your end? |
|
🔄 This repository is being replaced by a new version of Archon. The original Python/MCP codebase is being archived to the This PR is being closed as part of the migration. Thank you for your contribution! |
I hope the noob (me) did this correctly...
Addresses bug #759 https://github.com/coleam00/Archon/issues/759
This change enhances the Add Knowledge dialog's functionality, making it more user-friendly while adhering to design principles.
Pull Request
Summary
Dialog Overflow Fix Proposal
Problem Analysis
The
AddKnowledgeDialogcurrently exceeds window boundaries and gets cut off on smaller screens or when the dialog content is too tall. The issue stems from:fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2which centers it but doesn't respect viewport boundariesRoot Cause
Current DialogContent implementation (lines 42-62 in
dialog.tsx):AddKnowledgeDialog usage (line 130):
Proposed Solution
1. Enhanced DialogContent Component
Modify
DialogContentto include responsive height constraints and scroll behavior:2. New ScrollableDialogContent Component
Create a specialized component for dialogs that need scrollable content:
3. Enhanced AddKnowledgeDialog Implementation
Modify
AddKnowledgeDialogto use the new scrollable component:4. Alternative: CSS-Only Solution
If you prefer a simpler approach, modify only the existing
DialogContent:Implementation Steps
Option A: Enhanced Components (Recommended AND IMPLEMENTED)
Update
dialog.tsx:ScrollableDialogContentcomponentDialogContentwith optional height constraintsUpdate
AddKnowledgeDialog.tsx:DialogContentwithScrollableDialogContentTest & Validate:
Option B: CSS-Only Fix (Quick Solution)
Update
dialog.tsx:max-h-[90vh]andoverflow-y-autotoDialogContentTest:
Benefits
Considerations
Testing Checklist
Manual Tests:
Recommended Approach
Use Option A (Enhanced Components) for the following reasons:
The enhanced approach provides better user experience while maintaining the existing design system and ensuring accessibility standards are met.
Changes Made
Update
dialog.tsx:ScrollableDialogContentcomponentDialogContentwith optional height constraintsUpdate
AddKnowledgeDialog.tsx:DialogContentwithScrollableDialogContentTest & Validate:
Type of Change
Affected Services
Testing
Test Evidence
Checklist
Breaking Changes
Additional Notes
Summary by CodeRabbit
New Features
Refactor
Chores